Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 2 - Scripting Addition Commands / Command Definitions
/


Info For

The Info For command returns a record that contains information about a specified file or folder. The Info For command is one of several commands provided by the File Commands scripting addition.

SYNTAX
info for referenceToFile
PARAMETER
referenceToFile
A reference of the form file nameString or alias nameString.
Class: Reference
RESULT
A record of object class File Info (defined by the File Commands scripting addition) that contains the following properties:

name
Name of file or folder.
Class: String
creation date
Date and time the file or folder was first created.
Class: Date
modification date
Date and time the file or folder was last modified.
Class: Date
icon position
Location of the upper-left corner of the file or folder's icon.
Class: Point (defined by the QuickDraw suite as a two-item list of integers for horizontal and vertical coordinates)
visible
A value that indicates whether the file or folder's icon is visible on the desktop (true) or not (false).
Class: Boolean
Modifiable? No
size
The size of the file or folder in bytes.
Class: Integer
Modifiable? No
folder
A value that indicates whether the object described by the File Info record is a folder (true) or a file (false).
Class: Boolean
Modifiable? No
alias
Indicates whether the file is an alias (true) or not (false).
Class: Boolean
Modifiable? No
folder window
Four integers that specify the bounding rectangle of the folder window. Returned for folders only.
Class: Bounding rectangle (a list of four integers)
Modifiable? No
locked
Indicates whether the file or folder is locked (true) or unlocked (false).
Class: Boolean
Modifiable? No
file creator
Four-character creator code of the file. Returned for files only.
Class: String
Modifiable? No
file type
Four-character code for the file type of the file. Returned for files only.
Class: String
Modifiable? No
short version
The file's short version, if any. Returned for files only.
Class: String
Modifiable? No
long version
The file's long version, if any. Returned for files only.
Class: String
Modifiable? No
default application
The default application for a nonapplication file (for example, TeachText). Used with nonapplication files only.
Class: Alias
Modifiable? No
EXAMPLES
This example returns the entire File Info record for Scriptable Text Editor.

info for file "Hard Disk:Scriptable Text Editor"--result: {name:"Scriptable Text Editor", creation 
date:date "Tuesday, April 6, 1993 11:30:00 AM", 
modification date:date "Tuesday, April 6, 1993 11:30:00 
AM", icon position:{20, 349}, visible:true, size:88988, 
folder:false, alias:false, locked:false, file 
creator:"quil", file type:"APPL", short version:"1.1", long 
version:"1.1, Copyright © Apple Computer, Inc. 1991-93"}
This example returns just the file type for Scriptable Text Editor.

set x to info for ¬
   file "Turing's World:Scriptable Text Editor"x's file type
--result: "APPL"
This example displays a dialog box if the Scriptable Text Editor isn't locked.

if locked of ¬
   (info for file "Hard Disk:Scriptable Text Editor") ¬
   is false then
   display dialog "Scriptable Text Editor is not locked."end if 
NOTES
To specify the name (nameString) of a file, use a string of the form "Disk:Folder1:
Folder2:...:Filename"
as described in Chapter 5, "Objects and References,"
of the AppleScript Language Guide. If you specify only the name of the file (Filename) instead of its entire pathname, AppleScript attempts to find the file in the current directory.

ERRORS
Error
number
Error message
-35Disk <name> wasn't found.
-37Bad name for file.
-43File <name> wasn't found.
-50Parameter error.
-108Out of memory.
-120Folder <name> wasn't found.
-1700Can't make some data into the expected type.
-1701Some parameter is missing for <commandName>.
-1704Some parameter was invalid.
-1705Operation involving a list item failed.
-1718Reply has not yet arrived.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996